extension StringExt on String? {
  bool isPhoneNum({required String prefix, String? remark}) {
    String? phoneRegExp;
    if (this?.isEmpty == true || prefix == "") {
      return false;
    } else if (prefix == "86") {
      phoneRegExp = r"^1[2-9]\d{9}$";
    } else if (prefix == "852") {
      phoneRegExp = r"^([6|9])\d{7}$";
    } else if (prefix == "886") {
      phoneRegExp = r"^9\d{8}$";
    } else if (prefix == "213") {
      phoneRegExp = r"^(5|6|7)\d{8}$";
    } else if (prefix == "963") {
      phoneRegExp = r"^9\d{8}$";
    } else if (prefix == "966") {
      phoneRegExp = r"^5\d{8}$";
    } else if (prefix == "1" || remark?.startsWith('en-US') == true) {
      phoneRegExp = r"^[2-9]\d{2}[2-9](?!11)\d{6}$";
    } else if (prefix == "420") {
      phoneRegExp = r"^[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$";
    } else if (prefix == "49") {
      phoneRegExp = r"^([\(]{1}[0-9]{1,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$";
    } else if (prefix == "45") {
      phoneRegExp = r"^\d{8}$";
    } else if (prefix == "61") {
      phoneRegExp = r"^4\d{8}$";
    } else if (prefix == "44") {
      phoneRegExp = r"^7\d{9}$";
    } else if (prefix == "852") {
      phoneRegExp = r"^[569]\d{3}\-?\d{4}$";
    } else if (prefix == "91") {
      phoneRegExp = r"^[789]\d{9}$";
    } else if (prefix == "64") {
      phoneRegExp = r"^2\d{7,9}$";
    } else if (prefix == "27") {
      phoneRegExp = r"^\d{9}$";
    } else if (prefix == "26") {
      phoneRegExp = r"^09[567]\d{7}$";
    } else if (prefix == "34") {
      phoneRegExp = r"^(6\d{1}|7[1234])\d{7}$";
    } else if (prefix == "358") {
      phoneRegExp = r"^(4(0|1|2|4|5)?|50)\s?(\d\s?){4,8}\d$";
    } else if (prefix == "33") {
      phoneRegExp = r"^[67]\d{8}$";
    } else if (prefix == "972") {
      phoneRegExp = r"^([23489]|5[0248]|77)[1-9]\d{6}";
    } else if (prefix == "36") {
      phoneRegExp = r"^(20|30|70)\d{7}$";
    } else if (prefix == "39") {
      phoneRegExp = r"^3\d{2} ?\d{6,7}$";
    } else if (prefix == "81") {
      phoneRegExp = r"^\d{1,4}[ \-]?\d{1,4}[ \-]?\d{4}$";
    } else if (prefix == "601") {
      phoneRegExp = r"^{1}(([145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$";
    } else if (prefix == "47") {
      phoneRegExp = r"^[49]\d{7}$";
    } else if (prefix == "32") {
      phoneRegExp = r"^4?\d{8}$";
    } else if (prefix == "48") {
      phoneRegExp = r"^[5-8]\d ?\d{3} ?\d{2} ?\d{2}$";
    } else if (prefix == "55") {
      phoneRegExp = r"^[1-9]{2}\-?[2-9]{1}\d{3,4}\-?\d{4}$";
    } else if (prefix == "351") {
      phoneRegExp = r"^9[1236]\d{7}$";
    } else if (prefix == "7") {
      phoneRegExp = r"^9\d{9}$";
    } else if (prefix == "3816") {
      phoneRegExp = r"^[- \d]{5,9}$";
    } else if (prefix == "90") {
      phoneRegExp = r"^5\d{9}$";
    } else if (prefix == "84") {
      phoneRegExp = r"^((1(2([0-9])|6([2-9])|88|99))|(9((?!5)[0-9])))([0-9]{7})$";
    } else {
      phoneRegExp = r"";
    }
    if (this?.isEmpty == true) return false;
    return RegExp(phoneRegExp).hasMatch(this!);
  }
}
